import { request } from './request';

export function getCateData(queryInfo) {
  return request({
    url: 'categories',
    params: queryInfo 
  });
}

export function getParentCateList() {
  return request({
    url: 'categories',
    params: { type: 2 }
  });
}

export function addCate(addCateForm) {
  return request({
    method: 'post',
    url: 'categories',
    data: addCateForm
  });
}

export function getCateById(cateId) {
  return request({
    url: `categories/${cateId}`
  });
}

export function editCate(cat_id, cat_name) {
  return request({
    method: 'put',
    url: `categories/${cat_id}`,
    data: {
      cat_name
    }
  });
}

export function deleteCateById(cat_id) {
  return request({
    method: 'delete',
    url: `categories/${cat_id}`
  });
}